package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);unique;not null;comment:用户名"`
	Password string `gorm:"type:char(32);not null;comment:密码"`
	Mobile   string `gorm:"type:char(11);unique;comment:手机号"`
}

// 手机号查询信息
func (u *User) FindByMobile(mobile string) error {
	return DB.Where("mobile = ?", mobile).Find(&u).Error
}
